package actionHandlers;

import cuShapes.PQShape;
import palette.CanvasManager;
import palette.CanvasWindow;
import ca.odell.glazedlists.event.ListEvent;
import ca.odell.glazedlists.event.ListEventListener;

public class ShapeArrowListListener implements ListEventListener<PQShape>{

	@Override
	public void listChanged(ListEvent<PQShape> arg0) {
		//PQShape current = arg0.getSourceList().get(arg0.getIndex());
		//System.out.println(current.toString());
		
		//while(arg0.hasNext()) {
			//current = arg0.getSourceList().get(arg0.nextBlock());
			//if(arg0.getType() == ListEvent.INSERT) {
				//((CanvasWindow) (CanvasManager.getInst().getSelectedFrame())).getShapeTree().addNode(current);
			//} else if(arg0.getType() == ListEvent.DELETE) {
			//} else if(arg0.getType() == ListEvent.UPDATE) {
				
			//}
		//}
		
		// Uncomment the next line to see when this event is being handled.
		//System.out.println("listChanged event occured");
		((CanvasWindow) (CanvasManager.getInst().getSelectedFrame())).getShapeTree().formTreeFromList(arg0.getSourceList());
		((CanvasWindow) (CanvasManager.getInst().getSelectedFrame())).getShapeExplorer().getPane().updateUI();
	}

}
